package com.example.wechattakeaway.mapper;

import com.example.wechattakeaway.entity.UserAddress;
import com.example.wechattakeaway.form.addressform.InsertAddressForm;
import com.example.wechattakeaway.form.addressform.UpdateAddressForm;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserAddressMapper {

    /*
    新增一个收货地址
    @param InsertAddressForm
    @return UserAddress
     */
    Integer InsertAddress(UserAddress userAddress);

    /*
    更新一个收货地址
    @param UserAddress
    @return null
     */
    Integer UpdateAddress(UpdateAddressForm updateAddressForm);

    /*
    根据id删除一个收货地址
    @param addressId
    @return null
     */
    Integer DeleteAddress(Integer addressId);

    /*
    根据id查询一个收货地址
    @param userId
    @return UserAddress
     */
    UserAddress SelectAddressById(Integer userId);

    /*
    根据一个用户查询他所有的收货地址
    @param sysuserId
    @return list
     */
    List<UserAddress> SelectAddressByUser(Integer sysuserId);

}